<template>
	<view class="container">
		
		
		<view class="card" :style="{background: `linear-gradient(to bottom right,${memberLevels[current].bg_color},white)`}">
			<c-cu-custom  >
				<block slot="content" class="text-white">团队招募</block>
			</c-cu-custom>
			
			<u-swiper :list="memberLevels" 
			keyName="big_img"
			previousMargin="20" 
			nextMargin="20" 
			circular 
			:autoplay="false" 
			radius="5"
			@change="levelchange"
			bgColor="unset"></u-swiper>

			<view class="task padding-lg margin-bottom-lg  margin-top-lg" v-for="item,index in memberLevels" v-show="index==current">
				<view class="text-lg text-blod">
					晋升任务
				</view>
				<view v-for="item,idx in memberLevels[index].level_up_list"
					class="task-body flex justify-start align-center solid-bottom padding-bottom-sm padding-top-sm">
					<view class="task-left margin-right-sm">
						<image src="../../static/images/tabs/s_tab2.png" mode="aspectFill"
							style="height: 30px;width: 30px;"></image>
						<!-- <text class="cuIcon-hot lg text-orange"></text> -->
					</view>
					<view class="task-center">
						<view class="task-title text-black text-blod text-lg">
							{{ item.up_type_title }}<text class="text-sm margin-left-sm">(1/{{ item.times }})</text>
						</view>
						<view class="task-desc text-sm">
							任务描述任务描述任务描述任务描述任务描述任务描述任务描述任务描述任务描述任务描述任务描述任务描述任务描述任务描述任务描述任务描述
						</view>
					</view>
					<view class="task-right margin-left-sm">
						<button class="cu-btn round bg-theme text-white shadow">去完成</button>
					</view>
				</view>

			</view>
		</view>

		<view class="teach padding-lg bg-white">
			<view class="text-lg text-black text-blod margin-bottom-10">
				团队招募教学
			</view>
			<image :src="teamConf.display_img" style="width: 100%;" mode="widthFix" @click="navTo(teamConf)"></image>
			<view class="actions flex justify-center margin-top-lg">
				<button class="cu-btn round bg-theme text-white shadow">
					保存教学
				</button>

				<button class="cu-btn round bg-purple shadow margin-left-lg" @click="toPage('/pages/team/invite')">
					邀请团队成员
				</button>
			</view>
		</view>
	</view>
</template>

<script>
	import { getAllLevelInfo,getTeamConf } from "@/api/team.js";
	export default {
		data() {
			return {
				memberLevels: [],
				teamConf: {},
				current:0
			}
		},
		onLoad() {
			this.initLevels();
		},
		onShow() {
			this.initConf();
		},
		methods: {
			initLevels() {
				getAllLevelInfo().then(res => {
					this.memberLevels = res.data;
				});
			},
			initConf(){
				getTeamConf().then(res => {
					this.teamConf = res.data;
				});
			},
			levelchange(e) {
				this.current = e.current;
			},
		}
	}
</script>

<style lang="scss">
	.card {
		padding-top: 20px;
		padding-bottom: 20px;
	}

	.task {
		background-color: rgba(255, 255, 255, 0.8);
		border-radius: 15px;

		.task-body {
			.task-center {
				min-width: 50%;
				max-width: 60%;

				.task-title {}

				.task-desc {
					overflow: hidden;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
				}
			}
		}
	}

	.actions {
		margin-bottom: 3rem;
	}
</style>